import java.io.IOException;

import ca.uoit.dblp.Algorithm;
import ca.uoit.dblp.Algorithm.Transitive;
import ca.uoit.dblp.AuthorGraph;
import ca.uoit.dblp.Util;


public class run {
	public static void main(String[] args) {
		if(args.length != 1) {
			Util.p("Usage: run <input file>");
			System.exit(0);
		}
		String input = args[0];
		try {
			long m = Util.mem();
			long s = Util.now("Loading Graph...");
			//
				AuthorGraph G = (new AuthorGraph(input)).load(input);
			//
			Util.now(s);
			Util.mem(m);
			m = Util.mem();
			s = Util.now("Computing D0 ");
			//
				Algorithm.walk(G, new Algorithm.D0());
			//
			Util.now(s);
			Util.mem(m);
			
			m = Util.mem();
			s = Util.now("Computing transitive");
			//
				Transitive transitive = new Transitive(G);
				Algorithm.walk(G, transitive);
			//
			Util.now(s);
			Util.mem(m);
			
		} catch(IOException e) {
			Util.p("Error: " + e.getMessage());
			e.printStackTrace();
		}
	}
}
